fix(ci): force clang for Linux x86_64 native builds (#1054)#1059
Conversation
Verified locally: gcc 14.2.0 (Debian Trixie) builds a binary whose tree-sitter-hcl extractor silently drops the 4 HCL fixture files in tests/benchmarks/resolution/fixtures/hcl/. Clang 14 (Debian Bookworm) builds a binary that parses them correctly. Same Rust source, same Cargo.lock — only the C compiler differs (cc-rs uses CC for the bundled parser.c). The drop triggers an engine-parity WASM backfill on every full-build call (#1054), and the v3.10.0 pre-publish gate flagged the resulting ~1.7s overhead per call as a regression vs the v3.9.6 published binary (which evidently was built before this gcc/parser-c interaction manifested). Forces `CC=clang`/`CXX=clang++` in three places that build the host x86_64-unknown-linux-gnu artifact: - publish.yml `build-native` matrix entry for the gate's binary - publish.yml `preflight` job (so npm test parity matches published) - build-native.yml's matching matrix entry (host build for PR checks) - ci.yml `native-host-build` ubuntu-latest leg (so PR test runs match) Cross-compile targets (aarch64-gnu, x86_64-musl) are unaffected — they already pin their own toolchains. macOS and Windows are unaffected. Refs #1054
|
Claude finished @carlos-alm's task —— View job PR Review: fix(ci): force clang for Linux x86_64 native buildsTodo List
Root Cause AnalysisProblem Being Solved: The Linux x86_64 native binary built with gcc 14.2.0 silently drops 4 HCL fixture files in Why This Approach: The PR switches from gcc to clang for x86_64-linux-gnu builds based on local Docker verification showing gcc-built binaries drop .tf files while clang-built ones work correctly. This is a C compiler optimization issue in tree-sitter-hcl's bundled parser.c that cc-rs compiles. Risk Assessment: Low risk. The change is targeted to the specific problematic target ( Configuration Change Detection (LOW RISK)This PR makes targeted CI configuration changes to address a specific C compiler bug:
✅ No rules relaxed or thresholds lowered - this fixes a genuine compiler-level bug Test Integrity (EXCELLENT)✅ This PR follows the project's strict engine parity policy - per CLAUDE.md: "Both engines must produce identical results. If they diverge, the less-accurate engine has a bug — fix it, don't document the gap" ✅ Addresses root cause, not symptoms - fixes the gcc-compiled native engine to match WASM behavior, rather than documenting the divergence as acceptable ✅ Backed by local verification - author reproduced issue in Docker with both gcc 14.2.0 (drops files) and clang 14 (works correctly) ✅ Parity tests will validate the fix - existing Backlog Compliance
Critical ConcernsNone identified. This is a well-researched fix for a compiler-specific bug. Final Recommendation
Minor suggestion: Consider adding the companion PR #1058 mentioned in the description to make WASM backfill cheaper as defense-in-depth, but this PR stands on its own merit. |
Greptile SummaryThis PR fixes a silent HCL file drop in the Linux x86_64 native binary by forcing Confidence Score: 5/5Safe to merge — changes are limited to CI workflow files, correctly scoped to Linux x86_64 targets, and carry no risk of regression on other platforms. No P0 or P1 findings. All four affected jobs are correctly guarded (or need no guard). The No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CI / publish triggered] --> B{OS?}
B -->|ubuntu-latest| C[Run: clang --version\nSet CC=clang / CXX=clang++]
B -->|macOS / Windows| D[Use default toolchain\nNo CC override]
C --> E{Target?}
E -->|x86_64-unknown-linux-gnu| F[napi build --release\nwith clang]
E -->|aarch64-unknown-linux-gnu| G[Set CC=aarch64-linux-gnu-gcc\nnapi build --release cross]
E -->|x86_64-unknown-linux-musl| H[Set CC=musl-gcc\nnapi build --release cross]
F --> I[✅ HCL parser works\nno file drops]
G --> J[✅ Not affected\nown toolchain]
H --> K[✅ Not affected\nown toolchain]
D --> L[macOS/Windows build\nnot affected]
Reviews (1): Last reviewed commit: "fix(ci): force clang for Linux x86_64 na..." | Re-trigger Greptile |
Summary
Why clang specifically
Reproduced both sides locally in Docker:
Same Rust source (current main), same `napi build --release`, only `CC` differs.
Scope
Companion PR
#1058 makes the WASM backfill cheap when it does fire (defense-in-depth). This PR removes the trigger condition. With both, `Native orchestrator dropped 4 file(s)` should disappear from gate logs entirely.
Test plan
Refs #1054